/**
  ETFAna project, Anyang Normal University && IMP-CAS
  \class ETFUserF1Task
  \brief user class for tasks of F1 data analysis
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2024-01-10
  \date 2024-01-10 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                    </tr>
  <tr>  <td>2024-01-10   <td>Asia Sun    <td>file created                   </tr>
  </table>

  \copyright Copyright (c) 2021-2024 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFUserF1Task_h
#define ETFUserF1Task_h

#include "ETFTask.h"

class TFile;
class TTree;
class TClonesArray;
class ETFTimer4;
class ETFT0Array;

class ETFUserF1Task : public ETFTask{
public:
  ETFUserF1Task(const char *name = "UserF1");
  virtual ~ETFUserF1Task();

  virtual void Exec() override;
  virtual void Configure();
  virtual void Reset();

  // ClassDefOverride(ETFUserF1Task, 1); // user class for tasks in the tracking stage

protected:
  virtual void CreateHistos() override;
  virtual void WriteHistos() override;

  TFile *ff1; ///< the output rootfile
  TTree *f1; ///< the et tree - simpler, yet succinct
  
  int index_; // event index
  
  //----- T0 plastic strip array (120x(50x2)x1mm) -----//
  int multi; // nof of properly fired strips of F1 plastic array
  int stripIp[5]; // strip Id of F1 plastic array (starting from 0)
  double x_f1[5]; // F1 strip center x position (strip width: 2mm), x=0 is beam tube center
  double tlU[5][5], ttU[5][5]; // up end, leading and trailing edges: [strip][edge]
  double tlD[5][5], ttD[5][5]; // down end, leading and trailing edges: [strip][edge]
  
  //----- T0 plastic card (100x100x1mm) -----//
  double t0lR[5], t0tR[5]; // right (inner) end, leading and trailing edges: [edge]
  double t0lL[5], t0tL[5]; // left (outer) end, leading and trailing edges: [edge]
  double t0lU[5], t0tU[5]; // up end, leading and trailing edges: [edge]
  double t0lD[5], t0tD[5]; // down end, leading and trailing edges: [edge]

  ETFTimer4 *fT0F1;
  ETFT0Array *fT0Arr;
  TClonesArray *c0, *carr; // for T0F1 and T0Arr
};

#endif
